<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //解构赋值
        // const [a, b, c] = [1, 2, 3];
        // console.log(a, b, c);
        // 什么是解构赋值
        //解析某一数据的结构，将我们想要的东西提取出来 赋值给变量

        //数组解构赋值的原理：模式（结构）匹配，索引值相同的完成赋值


        //模式匹配
        //[]=[1,2,3];
        //索引值完成匹配
        //  const [a, b, c] = [1, 2, 3];
        //  console.log(a, b, c); //1  2  3


        //const [a, b, , c] = [1, 2, [4, 5], 8];
        //console.log(a, b, c);

        //模式匹配 索引值完成赋值
        //const [a, b, c] = [1, 2, 3];
        //console.log(a, b, c);

        //不取的直接用逗号跳过
        const [a, [b, , ], e] = [1, [2, 4, 5], 3];
        console.log(a, b, e); //1 2 3
    </script>
</body>

</html>